function Examine_Data(data, tableid) {
	var buffer = new StringBuffer();
	$(data).each(function(i,info){
		try{
		info.Context=decodeURI(info.Context);
		}catch(e){}
		buffer.append('<div class="sharelist border-bottom" tableid="'+tableid+'" id="'+info.ID+'" userid="'+info.UserID+'" username="'+info.RealName+'">');
		buffer.append('<div class="atitle">');
		buffer.append('<div class="aimg"><img src="'+info.HeadImg+'"/></div>');
		buffer.append('<div class="aname">'+info.RealName+'<font class="'+(info.State!=1?"reds":"greens")+'">'+info.StateText+'</font></div>');
		buffer.append('<div class="adate">'+info.CreateTime+'  &nbsp;&nbsp;&nbsp;&nbsp; 来自&nbsp;'+info.Version+'</div>');
		buffer.append('<div class="atag">'+info.TypeText+'</div>');
		buffer.append('</div>');
		if(info.ToUsers!="")
		{
			buffer.append('<div class="asendrange">抄送给：<font>'+info.ToUsers+'</font></div>');
		}
		buffer.append('<div class="aimg">');
		$(info.Imgs).each(function(k,img)
		{
		var right=k%3==2?0:5;
		buffer.append('<figure class="asquare" style="width:'+(swidth-30)/3+'px; heigth:'+(swidth-30)/3+'px; margin-right:'+right+'px; float:left; display:block;" itemscope itemtype="http://schema.org/ImageObject"><a src="'+img.Img1000+'" itemprop="contentUrl" data-size="'+img.Width+'x'+img.Height+'"><img src="' + img.Img200 + '" width="'+(swidth-30)/3+'" height="'+(swidth-30)/3+'" itemprop="thumbnail" alt="Image description"/></a></figure>');
		});
		buffer.append('</div>');
		if(info.Files.length>0)
		{
		buffer.append('<div class="afile">');
		$.each(info.Files,function(i,info)
		{
					buffer.append('<div class="file_list">');
						buffer.append('<div class="file_icon"><img src="img/'+GetICON(info.Path)+'"/></div>');
						buffer.append('<div class="file_info">');
							buffer.append('<div class="file_name">' + info.Name + '</div>');
							buffer.append('<div class="file_size">' + GetSize(info.Size) + '</div>');  
						buffer.append('</div>');
						buffer.append('<div class="file_download"><a href="javascript:void(0)" onclick=DownLoad(this,"'+info.Path+'")></a></div>');
					buffer.append('</div>');
		});
		buffer.append('</div>');
		}
		
			buffer.append('<div class="examineflow">');
			buffer.append('<div class="flow">');
			buffer.append('<div class="begin"></div>');
			buffer.append('<div class="line select"></div>');
			var prev_hasexamine = true;
			var show_tab = "hidden";
			$.each(info.DetailList, function(i, detail) {
				var len = detail.ExamineName.length;
				if (2 > len) {
					len = 2;
				}
				if (len > 4) {
					len = 4;
				}
				buffer.append('<div class="user' + len + '">' + detail.ExamineName + '</div>');
				buffer.append('<div class="line ' + (detail.HasExamine ? "select" : "") + '" val="' + detail.ExamineUser + '">');
				if (detail.HasExamine) {
					buffer.append('<div class="success"></div>');
				}
				buffer.append('</div>');
				if (detail.ExamineUser == User.ID && !detail.HasExamine && prev_hasexamine) {
					show_tab = "show";
				}
				prev_hasexamine = detail.HasExamine;
			});
			buffer.append('<div class="finish">完成</div>');
			buffer.append('</div>');
			buffer.append('</div>');
		if(info.Type==2)  //请假单
		{
		buffer.append('<div class="examinetable">');
		buffer.append('<table class="slimsy" style="width:100%;">');
		buffer.append('<tr><th width="17%">请假事项</th><th width="33%">开始时间</th><th width="33%">结束时间</th><th>时长</th></tr>');
		$.each(info.LeaveSheet,function(i,sheet){
		buffer.append('<tr>');
		buffer.append('<td>'+sheet.Name+'</td>');
		buffer.append('<td>'+sheet.BeginTime+'</td>');
		buffer.append('<td>'+sheet.EndTime+'</td>');
		buffer.append('<td>'+sheet.Time+'</td>');
		buffer.append('</tr>');
		});
		buffer.append('</table>');
		buffer.append('</div>');
		}
		if(info.Type==3)  //加班单
		{
		buffer.append('<div class="examinetable">');
		buffer.append('<table class="slimsy" style="width:100%;">');
		buffer.append('<tr><th width="40%">开始时间</th><th width="40%">结束时间</th><th>时长</th></tr>');
		$.each(info.OvertimeSheet,function(i,sheet){
		buffer.append('<tr>');
		buffer.append('<td>'+sheet.BeginTime+'</td>'); 
		buffer.append('<td>'+sheet.EndTime+'</td>');
		buffer.append('<td>'+sheet.Time+'</td>');
		buffer.append('</tr>');
		});
		buffer.append('</table>');
		buffer.append('</div>');
		}
		if(info.Type==4)  //报销单
		{
		buffer.append('<div class="examinetable">');
		buffer.append('<table class="slimsy" style="width:100%;">');
		buffer.append('<tr><th width="10%">序号</th><th width="50%">报销项名称</th><th width="15%">金额</th><th>备注</th></tr>');
		var allmoney = 0;
		$.each(info.ReimburseSheet,function(i,sheet){
		allmoney += sheet.Money;
		buffer.append('<tr>');
		buffer.append('<td>'+(i+1)+'</td>');
		buffer.append('<td>'+sheet.Name+'</td>');
		buffer.append('<td>'+sheet.Money.toFixed(2)+'</td>');
		buffer.append('<td>'+sheet.Bak+'</td>');
		buffer.append('</tr>');
		});
		buffer.append('</table>');
		buffer.append('<div class="money"><div class="casemoney">大写金额：<font>'+Convert_Money(allmoney)+'</font></div><div class="allmoney">合计金额：<font>'+allmoney.toFixed(2)+'</font></div></div>');
		buffer.append('</div>');
		}
		if(info.Type==5)  //差旅单
		{
		buffer.append('<div class="listline">出差人：'+info.PersonName+'</div>');
		buffer.append('<div class="listline">出差事由：'+info.Reason+'</div>');
		buffer.append('<div class="listline">预算：'+(info.Money > 0 ? ('<font class="reds">'+info.Money.toFixed(2)+'</font>元 '):'无')+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 预支："+(info.Advance > 0 ? ('<font class="reds">'+info.Advance.toFixed(2)+'</font>元'):'无')+'</div>');
		buffer.append('<div class="examinetable">');
		buffer.append('<table class="slimsy" style="width:100%;">');
		buffer.append('<tr><th width="10%">行程</th><th width="15%">出发地</th><th width="17%">出发时间</th><th width="15%">目的地</th><th width="17%">到达时间</th><th width="9%">交通工具</th><th width="9%">住宿（天）</th></tr>');
		$.each(info.TravelSheet,function(i,sheet){ 
		buffer.append('<tr>');
		buffer.append('<td>'+(i+1)+'</td>');
		buffer.append('<td>'+sheet.BeginPlace+'</td>');
		buffer.append('<td>'+sheet.BeginTime.ToDateMinute()+'</td>');
		buffer.append('<td>'+sheet.EndPlace+'</td>');
		buffer.append('<td>'+sheet.EndTime.ToDateMinute()+'</td>');
		buffer.append('<td>'+sheet.Traffic+'</td>');
		buffer.append('<td>'+sheet.Day+'天</td>');
		buffer.append('</tr>');
		});
		buffer.append('</table>');
		buffer.append('</div>');
		}
		if(info.Type==6)  //借款单
		{
		buffer.append('<div class="listline">借款人：'+info.RealName+'</div>');
		buffer.append('<div class="listline">借款金额：<font class="reds">'+info.Money.toFixed(2)+'</font>元</div>');
		buffer.append('<div class="listline">借款事由：'+info.Reason+'</div>');
		}
		if(info.Type==7)  //外勤单
		{
		buffer.append('<div class="listline">拜访客户：'+info.Customer+'</div>');
		buffer.append('<div class="listline">联 &nbsp;系 &nbsp;人：'+info.Contact.ToString()+'</div>');
		buffer.append('<div class="listline">联系方式：<font><a href="tel:'+info.Mobile+'">'+info.Mobile+'</a></font></div>');
		buffer.append('<div class="listline">拜访地址：<font class="greens">'+info.VisitAddress+'</font></div>');
		}
		buffer.append('<div class="acontent"><span>' + info.Context + '</span><div id="detail">'+info.Context.DHtml().Cut()+'</div></div>');
		if(info.Address!=""){
		buffer.append('<div class="aposition"><div class="icon"><img src="img/position2.png" height="22"/></div><div class="address">'+info.Address+'</div></div>');
		}
		buffer.append('<div class="atool">');
		if(info.UserID==userid){
		buffer.append('<div class="delete"><img src="img/delete.png" height="12"/></div>');
		}
		buffer.append('<div class="reply" showtab="'+show_tab+'" text="回复"><img src="img/replyes.png" height="12"/></div></div>');
		if(info.ReplyList.length>0)
		{
			buffer.append('<div class="replylist">');
			$(info.ReplyList).each(function(i,reply){
				try{
				reply.Context=decodeURI(reply.Context);
				}catch(e){}
				if(reply.ParentID==0)
				{
					buffer.append('<div class="replyline" id="'+reply.ID+'" userid="'+reply.UserID+'" tableid="'+tableid+'" username="'+reply.UserName+'" sid="'+info.ID+'" parentid="'+reply.ParentID+'"><font>'+reply.UserName+'：</font>'+reply.Context+'</div>');
				}else{
					buffer.append('<div class="replyline" id="'+reply.ID+'" userid="'+reply.UserID+'" tableid="'+tableid+'" username="'+reply.UserName+'" sid="'+info.ID+'" parentid="'+reply.ParentID+'"><font>'+reply.UserName+'</font>回复<font>'+reply.ToUserName+'：</font>'+reply.Context+'</div>');
				}
			});
			buffer.append('</div>');
		}
		buffer.append('</div>');
	});
	return buffer.toString();
};

function Examine_State(o) {
    $(o).parent().parent().parent().find("label").removeClass("greens");
    $(o).parent().next().addClass("greens");
};


function Init_Examine(){
	get("divmsgname").addEventListener("tap",function(){
		OpenOAScreen(Examine_Search_Code(),function(){
			Init_Examine_Search();
		},function(){Data_Search(4)});
	});
	
};

function Examine_Search_Code(){
	var buffer = new StringBuffer();
	buffer.append('<div class="searchtab"><div class="tab select" val="out">我发出的</div><div class="tab" val="in">我收到的</div></div>');
	buffer.append('<div class="searchline" style="margin-top:10px;"><div class="names">选择同事</div><div class="option"><input id="users_search" class="users" show="1" touserid="" todepartid="" tocomid="" type="text" placeholder="点击选择" readonly="readonly" value=""/></div></div>');
	buffer.append('<div class="searchline"><div class="names">审批状态</div><div class="option"><select id="state_search"><option value="">全部</option><option value="0">未审批</option><option value="1">已审批</option></select></div></div>');
	buffer.append('<div class="searchline"><div class="names">审批类型</div><div class="option"><select id="type_search"><option value="">全部</option><option value="1">普通审批</option><option value="2">请假单</option><option value="3">报销单</option><option value="4">差旅单</option><option value="5">借款单</option><option value="6">外勤单</option></select></div></div>');
	buffer.append('<div class="searchline"><div class="names">发布时间</div><div class="option"><input id="begindate_search" type="text" class="date" placeholder="开始时间" readonly="readonly"/><input id="enddate_search" type="text" class="date" placeholder="结束时间" readonly="readonly"/></div></div>');
	return buffer.toString();
};

function Init_Examine_Search(){
	mui(".searchtab").on("tap",".tab",function(){
		if($(this).attr("val")=="out")
		{
			$(this).css("border-right","1px solid #e3e2e2").siblings().css("border-left","0px");
		}else
		{
			$(this).css("border-left","1px solid #e3e2e2").siblings().css("border-right","0px");
		}
		$(this).addClass("select").siblings().removeClass("select");
		Data_Search(4);
	});
	mui(".option").on("tap",".date",function(){
		obj=this;
			var t=new Date();
			if($(this).val()!="")
			{
				var year_month_day=$(this).val().split("-");
				t.setFullYear(year_month_day[0]);
				t.setMonth(year_month_day[1]-1);
				t.setDate(year_month_day[2]);
			}
			plus.nativeUI.pickDate( function(e){
				var d=e.date;
				$(obj).val((d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate()).ToDate());
			},function(e){
				console.log( "未选择日期："+e.message );
			},{date:t});
	});
	get("users_search").addEventListener("tap",function(){
        	obj10=$(this);
			OpenWindow(3,"选择员工","确定",function(){
					var str1="",str2="",str3="",headimg="";
					touserid="";todepartid="";tocomid="";
	      			var count=0;
	      			mui.each(mui("#userlist input"),function(i,info){
	      				if(info.checked)
	      				{
	      					count++;
	      					touserid += info.value+",";
	      					str1 += info.getAttribute("val")+",";
	      				}
	      			});
	      			if(touserid.TrimEnd(",").split(",").length>1)
					{
						plus.nativeUI.toast("请选择1个员工");
						return;
					}
					if(str1=="")
	      			{
	      				obj10.val("").attr("touserid","");
	      			}else
	      			{
	      				
	      				obj10.val(str1.substring(0,str1.length-1)).attr("touserid",touserid.substring(0,touserid.length-1));
	      			}
	      			CloseWindow();
			});
			
			$("#contentlist3").html(CheckMate_Data());
			data = {};
			data.act = "DepartAndUser_Data";
			data.userid=userid;
			data.comid=comid;
			data.source=source;
			data.sign=GetSign(data.act);
			
			mui.getJSON(admin_domain, data, function(json) {
				Bind_CheckMate(json.data.user,json.data.depart);
				Init_CheckMate();
			});
			if($(this).attr("show")=="1")
	      	{
	      		$(".selectbar").hide();
	      	}else
	      	{
				$(".selectbar").show();  				
	      	}
	    });

};